/**
 * 
 * @author Huang Junjie
 */

package TimeSqueeze.common;

public class Time {

	private int year;
	private int month;
	private int day;
	private int hourMinute;

	public Time(int _year, int _month, int _day, int _hourMinute) {
		setYear(_year);
		setMonth(_month);
		setDay(_day);
		setHourMinute(_hourMinute);
	}

	public void setYear(int _year) {
		year = _year;
	}

	public void setMonth(int _month) {
		month = _month;
	}

	public void setDay(int _day) {
		day = _day;
	}

	public void setHourMinute(int _hourMinute) {
		hourMinute = _hourMinute;
	}

	public int getYear() {
		return year;

	}

	public int getMonth() {
		return month;

	}

	public int getDay() {
		return day;

	}

	public int getHourMinute() {
		return hourMinute;

	}

	@Override
	public String toString() {
		return day + "/" + month + "/" + year + " " + hourMinute;
	}

	public String toFile() {
		return year + " " + month + " " + day + " " + hourMinute;
	}

	/*
	 * If time2 occurs after 'this time', return true
	 */
	public boolean isAfter(Time time2) {
		if ((time2.year > this.year)
				|| (time2.year == this.year && time2.month > this.month)
				|| (time2.year == this.year && time2.month == this.month && time2.day > this.day)
				|| (time2.year == this.year && time2.month == this.month
						&& time2.day == this.day && time2.hourMinute > this.hourMinute)) {
			return true;
		}

		return false;
	}

}